<?php

class ProfileView extends View {
	
	protected $user;
	protected $sales;
	
	function __construct() {
	
	}
	
	function getUser() {
		return $this->user;
	}
	
	function setUser($user) {
		$this->user = $user;
	}
	
	function getSales() {
		return $this->sales;
	}
	
	function setSales($sales) {
		$this->sales = $sales;
	}
	
	function display() {
		echo '<div>';
		echo '<table border=0>';
		echo '<tr><td>First Name</td><td>'.$this->user->getFirstName().'</td></tr>';
		echo '<tr><td>Last Name</td><td>'.$this->user->getLastName().'</td></tr>';
		echo '<tr><td>Credit Type</td><td>'.$this->user->getCreditType().'</td></tr>';
		echo '<tr><td>Credit Number</td><td>'.$this->user->getCreditNumber().'</td></tr>';
		echo '<tr><td>Address</td><td>'.$this->user->getAddress().'</td></tr>';
		echo '<tr><td>Phone Number</td><td>'.$this->user->getPhoneNumber().'</td></tr>';
		echo '</table>';
		echo '<br />';
		echo '<hr />';
		echo '<br />';
		if ($this->sales) {
			echo '<div style="width:90%; margin-top:20px;">';
			echo '<h3 style="margin-bottom:10px;">Sales History</h3>';
			echo '<table class="table table-striped">';
			echo '<thead><th>Title</th><th>Copies</th><th>Date</th></thead>';
			foreach ($this->sales as $movie) {
				echo '<tr><td>'.$movie->getMovieTitle().'</td>
						<td>'.$movie->getNoCopies().'</td>
						<td>'.$movie->getOdate().'</td>
						</tr>';
			}
			echo '</table>';
			echo '</div>';
		}
	}
	
}

?>